/*
 * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package std.containers;

export namespace containers {

    /**
    * List interface
    */
    export interface List{{T}} {
        /**
        * Pushes a value to the begin of the List
        *
        * @param e value to push
        */
        pushFront(e: {{T}}): void;

        /**
        * Pops a value from the begin of the List
        *
        * @returns popped value
        */
        popFront(): {{T}};

        /**
        * Pushes a value to the end of the List
        *
        * @param e value to push
        */
        pushBack(e: {{T}}): void;

        /**
        * Pops a value from the end of the List
        *
        * @returns popped value
        */
        popBack(): {{T}};

        /**
        * Returns number of elements in the List
        *
        * @returns number of elements in the List
        */
        size(): int;

        /**
        * Returns an element at the specified index
        *
        * @param index element position
        *
        * @returns an element
        */
        at(index: int): {{T}};

        /**
        * Sets an element at the specified index
        *
        * @param index element position
        *
        * @param e new value
        */
        set(index: int, e: {{T}}): void;

        /**
        * Checks if an element is in the List
        *
        * @param e value to find
        *
        * @returns true if value present, false otherwise
        */
        has(e: {{T}}): boolean;

    /*  Code below is blocked by internal issue with lambdas #9994
        forEach(fn: (e: {{T}}): {{T}}): List{{T}};
        map{{U}}{{LU}}(fn: (e: {{T}}): {{U}}): {{LU}};
        fold(combine: (lhs: {{T}}, rhs: {{T}}): {{T}}): {{T}};
        foldWith{{U}}(combine: (lhs: {{T}}, rhs: {{T}}): {{U}}, initVal: {{U}}): {{U}};
        filter(filterCond: (e: {{T}}): boolean): List{{T}};
        sort(comparator: (lhs: {{T}}, rhs: {{T}}): boolean): List{{T}};
    */
    }
}
